import request from '@/utils/request'

export const fetchUsers = params => {
  return request({
    url: `/users`,
    method: 'get',
    params
  })
}
export const addUsers = data => {
  return request({
    url: `/users`,
    method: 'post',
    data
  })
}
export const editUsers = (data, id) => {
  return request({
    url: `/users/${id}`,
    method: 'put',
    data
  })
}
export const changeUsers = id => {
  return request({
    url: `/users/${id}`,
    method: 'delete'
  })
}
export const fetchRoles = params => {
  return request({
    url: `/user-roles`,
    method: 'get',
    params
  })
}
export const addRoles = data => {
  return request({
    url: `/user-roles`,
    method: 'post',
    data
  })
}
export const editRoles = (data, id) => {
  return request({
    url: `/user-roles/${id}`,
    method: 'put',
    data
  })
}
export const changeRoles = id => {
  return request({
    url: `/user-roles/${id}`,
    method: 'delete'
  })
}
